/*
 * @Descripttion: 
 * @version: 
 * @Author: hzx
 * @Date: 2021-03-05 14:42:20
 * @LastEditors: hzx
 * @LastEditTime: 2021-03-25 23:49:02
 */
import { createStore } from 'vuex'

const store = createStore({
    state: {
        //存储教师或学生的登录状态
        resourceId: ''
    },
    mutations: {
        //设置教师或学生的登录状态
        changeResourceId(state, resourceId) {
            if (resourceId) {
                localStorage.setItem('changeResourceId', JSON.stringify(resourceId));
            }
            //console.log(resourceId)
            state.resourceId = resourceId
            
        }
    },
    actions: {
    },
    modules: {
    }
})

export default store
if (window.localStorage.getItem('changeResourceId')) {
    store.commit('changeResourceId', JSON.parse(window.localStorage.getItem('changeResourceId')));
}